package com.example.controller;

import com.example.util.SearchHttpAK;
import com.example.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 用以获取当前ip所在的大致地址
 * @author ..
 * @Date 2023/10/13 18:41
 */
@RestController
@RequestMapping("city")
public class CityController {

    @Autowired
    SearchHttpAK searchHttpAK;


    @PostMapping("{ip}")
    public Result tt(@PathVariable String ip) throws Exception {
        Map params = new LinkedHashMap<String, String>();
        params.put("ip", ip);
        params.put("coor", "bd09ll");
        params.put("ak", searchHttpAK.AK);
        String data = searchHttpAK.requestGetAK(params);
        return new Result(200,"",data);
    }
}
